import {Component, EventEmitter, Input, Output} from '@angular/core';

/**
 * Generated class for the SpinnerTotalComponent component.
 *
 * See https://angular.io/docs/ts/latest/api/core/index/ComponentMetadata-class.html
 * for more info on Angular Components.
 */
@Component({
  selector: 'spinner-total',
  templateUrl: 'spinner-total.html'
})
export class SpinnerTotalComponent {

  @Input() price = 0.00;
  @Input() num = 0;
  @Input() max = 0;
  @Input() total = 0.00;
  @Output() onNumChanged = new EventEmitter<{ num: number, total: number }>();

  onSpinnerChanged(num) {
    this.num = num;
    this.total = this.num * this.price;
    console.log(this.total);
    this.onNumChanged.emit({num: this.num, total: this.total});
  }
}
